package com.ywl.exercise.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.ywl.exercise.dao.BaseDao;
import com.ywl.exercise.dao.ImageDao;
import com.ywl.exercise.entity.ImageEntity;
import com.ywl.exercise.entity.vo.ImageVoEntity;


@Repository
public class ImageDaoImpl extends BaseDao<ImageEntity> implements ImageDao {
	
	@SuppressWarnings("unchecked")
	@Override
	public List<ImageVoEntity> findImageVo() {
		String hql = "select new com.ywl.exercise.entity.vo.ImageVoEntity("
				+ "i.imageid,i.categoryid,i.url,i.mark,i.answer,c.categoryname)"
				+ " from ImageEntity i,CategoryEntity c where i.categoryid = c.categoryid";
		Query query = super.createQuery(hql);
		return query.list();
	}
}
